/**
 * ProvinceMapper.java 
 * Copyright © 2015-3015, 杭州泊享网络科技有限公司
 * 
 * @author Liu Tao
 * @create 2013年8月14日
 */
package com.pshare.artemis.basic.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import com.pshare.framework.mapper.BaseMapper;
import com.pshare.artemis.basic.bean.Province;

/**
 * 省份持久层
 */
@Repository
public interface ProvinceMapper extends BaseMapper<Integer, Province> {

	@Select("select id, name, sequence from tbl_base_province")
	public List<Province> queryAll();
	
	/**
	 * 根据ID读取省信息
	 * @param id
	 * @return Province
	 */
	@Select("select * from tbl_base_province where id = #{id}")
	public Province get(@Param("id") Integer id);
	
	/**
	 * 根据名称查找省ID
	 * @param name
	 * @return Integer
	 */
	@Select("select id from tbl_base_province where full_name like #{name} '%' ")
	public Integer findIdByName(@Param("name") String name);
	
	@Select("select * from tbl_base_province where full_name like #{name} '%' ")
	public Province findByName(@Param("name") String name);
	
}
